<template>
  <h2>这里是新闻内容</h2>
  <div>
    <!-- {{ route.query.id }} -->
    {{ route.params.id }}
  </div>

  <div>
    {{ id }}
  </div>
</template>

<script setup>
import { useRoute } from 'vue-router'
import { onMounted, onUnmounted } from 'vue'

onMounted(() => {
  console.log('---NewsDetail挂载了')
})
onUnmounted(() => {
  console.log('---NewsDetail卸载了')
})

const route = useRoute()
const props = defineProps(['id'])
console.log(props)

// 获取路由参数
// console.log(route.params)
// console.log(route.query)
</script>

<style lang="scss" scoped></style>
